package com.ruoyi.web.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.web.domain.GuMrGuDapan;
import com.ruoyi.web.service.IGuMrGuDapanService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 大盘指数列Controller
 * 
 * @author ruoyi
 * @date 2025-10-25
 */
@RestController
@RequestMapping("/guDapan")
public class GuMrGuDapanController extends BaseController
{
    @Autowired
    private IGuMrGuDapanService guMrGuDapanService;

    /**
     * 查询大盘指数列列表
     */
    @RequiresPermissions("web:dapan:list")
    @GetMapping("/list")
    public TableDataInfo list(GuMrGuDapan guMrGuDapan)
    {
        startPage();
        List<GuMrGuDapan> list = guMrGuDapanService.selectGuMrGuDapanList(guMrGuDapan);
        return getDataTable(list);
    }

    /**
     * 导出大盘指数列列表
     */
    @RequiresPermissions("web:dapan:export")
    @Log(title = "大盘指数列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GuMrGuDapan guMrGuDapan)
    {
        List<GuMrGuDapan> list = guMrGuDapanService.selectGuMrGuDapanList(guMrGuDapan);
        ExcelUtil<GuMrGuDapan> util = new ExcelUtil<GuMrGuDapan>(GuMrGuDapan.class);
        util.exportExcel(response, list, "大盘指数列数据");
    }

    /**
     * 获取大盘指数列详细信息
     */
    @RequiresPermissions("web:dapan:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(guMrGuDapanService.selectGuMrGuDapanById(id));
    }

    /**
     * 新增大盘指数列
     */
    @RequiresPermissions("web:dapan:add")
    @Log(title = "大盘指数列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GuMrGuDapan guMrGuDapan)
    {
        return toAjax(guMrGuDapanService.insertGuMrGuDapan(guMrGuDapan));
    }

    /**
     * 修改大盘指数列
     */
    @RequiresPermissions("web:dapan:edit")
    @Log(title = "大盘指数列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GuMrGuDapan guMrGuDapan)
    {
        return toAjax(guMrGuDapanService.updateGuMrGuDapan(guMrGuDapan));
    }

    /**
     * 删除大盘指数列
     */
    @RequiresPermissions("web:dapan:remove")
    @Log(title = "大盘指数列", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(guMrGuDapanService.deleteGuMrGuDapanByIds(ids));
    }
}
